home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / comp / yylexhid.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.5 KB  |  51 lines

  1. /*
  2.                                 Y Y L E X H I D . C
  3.  
  4.                    Function called when yylex_file() is at eof.
  5.  
  6.     If new hidden functions are defined, then the array hidden[] must be
  7.     enlarged to contain the name of the new function.
  8. */
  9.  
  10. #include "iccomp.h"
  11.  
  12. static int
  13.     hidden_index = -1;                      /* hidden function index */
  14.  
  15. static char
  16.     *cp = nullstring;
  17.  
  18. int yylex_hidden(char *buf, register int max_size)
  19. {
  20.     register int
  21.         result = 0;
  22.  
  23.     while (max_size)                        /* fill as much as possible */
  24.     {
  25.         if (!*cp)                           /* test available source */
  26.         {
  27.             if                              /* test if next index will point */
  28.             (                               /* to another hidden function */
  29.                 hidden_index
  30.                 ==
  31.                 sizeof(hidden) / sizeof(HIDDEN_FUNCTION_) - 1
  32.             )
  33.                 break;                      /* if not: done, return 'result' */
  34.  
  35.             hidden_index++;                 /* next index and next source */
  36.  
  37.  
  38.             if (!hidden[hidden_index].this)
  39.                 continue;                   /* if not called, no code */
  40.  
  41.             cp = hidden[hidden_index].source;
  42.         }
  43.  
  44.         result++;                           /* count a char for the return */
  45.         max_size--;                         /* one char filled */
  46.         *buf++ = *cp++;                     /* and copy the char           */
  47.     }
  48.  
  49.     return (result);                        /* number of chars processed   */
  50. }
  51.